package com.jt.controller;

import com.jt.pojo.Collect;
import com.jt.service.CollectService;

import com.jt.vo.PageResult;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/collect")
public class CollectController {

    @Autowired
    private CollectService collectService;

    @GetMapping("/getCollectList")
    public SysResult getCollectList(PageResult pageResult){
        pageResult = collectService.getCollectList(pageResult);
        return SysResult.success(pageResult);//5
    }

    /**
     * 修改状态
     */
    @PutMapping("/updateCollectStatus")
    public SysResult updateCollectStatus(@RequestBody Collect collect){
        collectService.updateCollectStatus(collect);
        return SysResult.success();
    }

    /**
     * 删除
     */
    @DeleteMapping("/deleteCollectById")
    public SysResult deleteCourseById(Collect collect){
        collectService.deleteCollectById(collect);
        return SysResult.success();
    }

    /**
     * 修改
     * @param collect
     * @return
     */
    @PutMapping("/updateCollectById")
    public SysResult updateCollectById(@RequestBody Collect collect){
        collectService.updateCollectById(collect);
        return SysResult.success();
    }

    /**
     * 新增
     */
    @PostMapping("/saveCollect")
    public SysResult saveCollect(@RequestBody Collect collect){
        collectService.saveCollect(collect);
        return SysResult.success();
    }



}
